import { defineStore } from 'pinia';
interface FieldNames {
  idName: string;
  labelName: string;
  componentType: string;
  valueName: string;
}
//该store用于控件信息配置
const useControlFormStore = defineStore('controlForm', {
  state: () => {
    return {
      selectFormItem: {}, //选中的控件
      //控件部分字段
      fieldNames: {
        idName: 'id',
        labelName: 'cnName',
        componentType: 'componentType',
        valueName: 'values'
      }
    };
  },
  //计算属性
  getters: {},
  actions: {
    fieldNamesSetting(fieldNames: FieldNames) {
      this.fieldNames = fieldNames;
    },
    init() {
      this.fieldNames = {
        idName: 'id',
        labelName: 'cnName',
        componentType: 'componentType',
        valueName: 'values'
      };
    }
  }
});

export default useControlFormStore;
